package com.woniuxy.goods.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.commons.request.ResponseResult;
import com.woniuxy.goods.service.PointsService;
import com.woniuxy.goods.vo.PointsRecordVo;
import com.woniuxy.goods.vo.PointsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/points")
public class PointsController {

    @Resource
    private PointsService pointsSerice;
    @GetMapping("/findAll")
    public ResponseResult<PageInfo<PointsVo>> findAll(Integer currentPage, Integer pageSize, String name){
        return new ResponseResult<>(ResponseResult.OK,pointsSerice.findAll(currentPage,pageSize,name));
    }

    @GetMapping("/findById/{uid}")
    public ResponseResult<PointsVo> findById(@PathVariable("uid") Integer uid){
        return new ResponseResult<>(ResponseResult.OK, pointsSerice.findById(uid));
    }

    @GetMapping("/findpointsRecord")
    public ResponseResult<PageInfo<PointsRecordVo>> findpointsRecord(Integer currentPage, Integer pageSize, String name){
        return new ResponseResult<>(ResponseResult.OK,pointsSerice.findpointsRecord(currentPage,pageSize,name));
    }


}
